﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MN.Framework.Common.Security
{
    public class SecurityContext : BaseContext
    {
        public SecurityContext(string connectionString) : base("DatabasePezeshkiEntities") { }

        public DbSet<User> Users { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<UsersInRole> UsersInRole { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            // mappings 
            // modelBuilder.Entity<UsersInRole>().ToTable("UsersInRoles");
            modelBuilder.Configurations.Add(new UsersInRoleMap());
            modelBuilder.Configurations.Add(new RoleMap());
            modelBuilder.Configurations.Add(new UserMap());
        }

    }
}
